Description | Called when the floater becomes visible, and whenever the selection changes (when focus switches to a new document, or when the insertion pointer moves to a new location in the current document). This function should be defined only if the floater must track the selection. |
Note: Only define selectionChanged() if you absolutely require it, because its existence impacts performance. |
|
Arguments | None. |
Returns | Nothing. |
Example | The following instance of selectionChanged() shows a different panel (layer) in the floater depending on whether the selection is a script marker or something else: |
![]() |
function selectionChanged(){ /* get the selected node */ var theDOM = dw.getDocumentDOM(); var theNode = dw.getSelectedNode(); /* check to see if the node is a script marker */ if (theNode.nodeType == Node.ELEMENT_NODE && theNode.tagName == "SCRIPT"){ document.layers['blanklayer'].visibility = 'hidden'; document.layers['scriptlayer'].visibility = 'visible'; }else{ document.layers['scriptlayer'].visibility = 'hidden'; document.layers['blanklayer'].visibility = 'visible'; } } |
|
![]() |